jun.AreaGrid = Ext.extend(Ext.grid.GridPanel, {title: "Master Area", id: "docs-jun.AreaGrid", iconCls: "silk-grid", viewConfig: {forceFit: !0}, sm: new Ext.grid.RowSelectionModel({singleSelect: !0}), plugins: [new Ext.ux.grid.GridHeaderFilters], columns: [
    {header: "Kode Area", sortable: !0, resizable: !0, dataIndex: "area_code", width: 100, filter: {xtype: "textfield"}},
    {header: "Nama Area", sortable: !0, resizable: !0, dataIndex: "area_name", width: 100, filter: {xtype: "textfield"}},
    {header: "Status", sortable: !0, resizable: !0, dataIndex: "status", width: 100, filter: {xtype: "textfield"}, renderer: jun.renderActive}
], initComponent: function () {
    this.store = jun.rztArea, this.bbar = {items: [
        {xtype: "paging", store: this.store, displayInfo: !0, pageSize: 20}
    ]}, this.tbar = {xtype: "toolbar", items: [
        {xtype: "button", text: "Tambah Area", ref: "../btnAdd"},
        {xtype: "tbseparator"},
        {xtype: "button", text: "Ubah Area", ref: "../btnEdit"}
    ]}, this.store.baseParams = {mode: "grid"}, this.store.reload(), this.store.baseParams = {}, jun.AreaGrid.superclass.initComponent.call(this), this.btnAdd.on("Click", this.loadForm, this), this.btnEdit.on("Click", this.loadEditForm, this), this.getSelectionModel().on("rowselect", this.getrow, this)
}, getrow: function (sm, idx, r) {
    this.record = r, this.sm.getSelections()
}, loadForm: function () {
    var form = new jun.AreaWin({modez: 0});
    form.show()
}, loadEditForm: function () {
    var selectedz = this.sm.getSelected();
    if ("" == selectedz)return Ext.MessageBox.alert("Warning", "Anda belum memilih Jenis Pelayanan"), void 0;
    var idz = selectedz.json.area_id, form = new jun.AreaWin({modez: 1, id: idz});
    form.show(this), form.formz.getForm().loadRecord(this.record)
}, deleteRec: function () {
    Ext.MessageBox.confirm("Pertanyaan", "Apakah anda yakin ingin menghapus data ini?", this.deleteRecYes, this)
}, deleteRecYes: function (btn) {
    if ("no" != btn) {
        var record = this.sm.getSelected();
        return"" == record ? (Ext.MessageBox.alert("Warning", "Anda Belum Memilih Data"), void 0) : (Ext.Ajax.request({url: "Area/delete/id/" + record.json.area_id, method: "POST", success: function (f) {
            jun.rztArea.reload();
            var response = Ext.decode(f.responseText);
            Ext.MessageBox.show({title: "Info", msg: response.msg, buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.INFO})
        }, failure: function (f,a) {
            switch (a.failureType) {
                case Ext.form.Action.CLIENT_INVALID:
                    Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values');
                    break;
                case Ext.form.Action.CONNECT_FAILURE:
                    Ext.Msg.alert(a.response.statusText, a.response.responseText);
                    break;
                case Ext.form.Action.SERVER_INVALID:
                    Ext.Msg.alert('Failure', a.result.msg);
            }
        }}), void 0)
    }
}});
//jun.AreaGridWin =Ext.extend(Ext.Window, {
//    title: 'Master Area',
//    modal: !0,
//    padding: 5,
//    closeForm: !1,
//    layout: 'fit',
//    width: 500,
//    height: 300,
//    iswin: !0,
//    initComponent: function () {
//       this.items = [new jun.AreaGrid()],
//            jun.AreaGridWin.superclass.initComponent.call(this)
//    }
//});